home *** CD-ROM | disk | FTP | other *** search
/ Zoom 2 / Zoom - Release 2 (1996)(Active Software)[!].iso / programming / amos / amossible / base < prev    next >
Encoding:
Text File  |  1980-05-15  |  14.2 KB  |  310 lines

  1.                       A GENERAL TOUR AROUND AMOS
  2.                      ****************************
  3.  
  4.     The info within this file is just basic stuff to help you get started-
  5. But do read it carefully,as you might learn something you didn't know!
  6.  
  7.  
  8. --------------How to Use "AMOSSIBLE-The Total Beginners Guide"---------------
  9.  
  10.    The main purpose behind this disk is to give you a basic knowledge of
  11. programming in AMOS(And even programming in general).
  12.    To gain the most from this disk,you should follow these guidelines:
  13.  
  14. IF YOU HAVE ANY TROUBLE UNDERSTANDING ANY OF THE WORDS WRITTEN ON THE
  15. DISK,LOOK AT THE DEFINITIONS FILE,WHICH IS ALSO ON THE DISK.
  16.  
  17. First,get a pen and some paper,you'll probably need to make notes on every
  18. subject(You can refer back to each section,but writing some keypoints down
  19. will help to make it even clearer).
  20.   Make sure you read all of those `docs'(text files)-We've included these so
  21. that we can write a large amount on certain subjects-Which will hopefully
  22. make things alot clearer for you.
  23.   When studying the AMOS code,experiment with it-Try adjusting one variable
  24. to see what it affects,or try adding a few more lines to see how they change
  25. the entire program.
  26.    Read your AMOS manual again-This might seem like odd advice,but when you
  27. have seen some examples on this disk you might stand a better chance of
  28. understanding how a command works.
  29.    But the real things you need are a bit of patience and bags of
  30. enthusiasm-Without the will to actually LEARN about AMOS,you will have a
  31. real struggle on your hands.
  32.    Don't expect to be able to make a game in a month-Start simple with
  33. little programs,then build up steadily,and by the time you're ready to make
  34. a game,it will seem to come easily.
  35.  
  36. *****************************************************************************
  37.                   P  S  E  U  D  O     C  O  D  E
  38.                  =================================
  39.  
  40.  What?
  41. Pseudo code isn't actually a language,and it isn't essential to your
  42. programming success-But it can be incredibly handy when designing your
  43. projects.
  44.  When you type in a program in AMOS(Or any programming language),you have to
  45. make sure all that you type in is in the correct language and the correct
  46. syntax(in other words,all the dots,lines and squiggles are in the right
  47. places,and all the commands are in the right order),but this is a pain when
  48. working out the program,especially if you're a beginner.
  49.    A clever way of getting around this is to write out a plan of the program
  50. in a near-English dialect called "Pseudo Code".
  51.   Instead of writing out "X=X-1",you might just write "Decrease the X
  52. variable",or an alternative to "Screen Open 0,320,256,32,lowres",would be
  53. "Open a 32 colour low resolution screen"-The idea is to write a more
  54. understandable version of the line-In fact if you can see how to write a
  55. `good' pseudo code program,you'll find it alot easier to do the real
  56. thing-The more planning you do before hand,the faster you'll be able to
  57. work-Many problems or mistakes can be eliminated at this stage,which saves
  58. you from alot of hassle later on.
  59.   The thing to remember is that pseudo code is just a planning aid;If you
  60. entered it into AMOS and tried to `run' it,nothing would happen-Or you'd get
  61. alot of errors.
  62.  
  63. As a simple example of a games program,here is a small listing written in a
  64. sort of Pseudo code.
  65.   The `game' places the player(in a `space ship')on screen,the player moves
  66. the ship around with the joystick,but must try to avoid a few land mines
  67. which are placed near it.
  68.  
  69.  
  70. Open screen zero in 32 colour low resolution.
  71. Turn flashing cursor off.
  72. Clear screen in colour zero.
  73. Load Bob bank.
  74. Get Bob banks colours.
  75. Define X variable.
  76. Define Y variable.
  77. Place first land mine Bob on screen.
  78. Place Second land mine Bob on screen.
  79. Place third land mine Bob on screen.
  80. Place fourth land mine Bob on screen.
  81. Start main loop.
  82. If joystick 1 is pushed left decrease X variable.
  83. If joystick 1 is pushed right increase X variable.
  84. If joystick 1 is pushed up decrease Y variable.
  85. If joystick 1 is pushed down increase Y variable.
  86. Place players Bob on screen.
  87. If there is a collision between the player and mines then display a
  88. game over message,wait for a second,then end the program.
  89. Return to the start of the main loop.
  90.  
  91.  
  92. Now heres how you'd write that program for real in AMOS:
  93. (You'll have to create your own Bob bank to use this example-Bob 1(In the
  94. main loop)is the player,and Bobs 2 to 5 are the land mines-The Bob banks
  95. name here is "Blobs.Abk")
  96.  
  97. Screen Open 0,320,256,32,Lowres
  98. Flash off:Curs off
  99. Cls 0
  100. Load "Blobs.Abk"
  101. Get Bob Palette
  102. X=150
  103. Y=100
  104. Bob 2,20,20,2
  105. Bob 3,290,20,2
  106. Bob 4,20,180,2
  107. Bob 5,290,180,2
  108. Do
  109. If Joy(1)=4 Then X=X-1
  110. If Joy(1)=8 Then X=X+1
  111. If Joy(1)=1 Then Y=Y-1
  112. If Joy(1)=2 Then Y=Y+1
  113. Bob 1,X,Y,1
  114. If Bob Col(1,2 to 5)Then Print At(10,7);"Blown Up!":Wait 50:Edit
  115. Loop
  116.  
  117.  
  118. *****************************************************************************
  119.  
  120. ----How Does A Program Work?----
  121.  
  122.   Okay,so some of you out there might be experienced enough to know a bit
  123. about the structuring of a program,but for the benefit of Total
  124. Beginners,heres a summary.
  125.   When you enter some commands into a program editor,you usually have an
  126. aim-You want the computer to do something for you-So you enter commands
  127. in certain combinations to hopefully make it work correctly,when you've done
  128. this,you must `Run' the program;What this involves is the computer reads
  129. through the commands you have typed in,and if they are correctly typed,it
  130. will perform the tasks they `ask' it to.It will usually read through the
  131. commands from the top to the bottom of the screen(and scroll further down if
  132. you have entered alot of lines),but some times,you may have told it to jump
  133. to a certain collection of commands(Known as a "Subroutine"),where the
  134. commands will be carried out,then it can be sent back to where it left off
  135. if you so wish.
  136.   There is no hard and fast way of starting off a program,but it will
  137. usually begin with the opening of relevant screens,and setting up variables.
  138.    Then any Bobs or Sprites,sounds,music and various other bits of
  139. information can be loaded in.
  140.   Starting with a `label',the main part of the program comes next,this
  141. usually contains the most important parts of the program,which are `used'
  142. alot of the time.
  143.   In a `shoot 'em up' like "Space Invaders" for instance,the main part of
  144. the program (Or "loop" as its called)might contain various commands that
  145. test for collisions between the moving objects on screen,any joystick
  146. movements,or any statistic changes(The `energy' of the player,for example)
  147. -from these tests,the computer will either get a positive or negative
  148. response(in general,that is-That isn't to say there can't be many different
  149. ones,but this is a simple example)-If the result is positive(Such as
  150. joystick movement being detected)then the program will react to it there and
  151. then,or be sent on to a subroutine-which makes its own various checks-And
  152. then returns to the main program(Typically with a "Return" or "Goto"
  153. command).
  154.   Also included in the main program will be checks for collisions between
  155. the enemies and player,changes to the score,and tests for any of the
  156. specific victory(Or defeat)conditions.
  157.    Obviously,a game can have far more features than this,or less-It all
  158. depends on what you want the program to do.
  159.  
  160. *****************************************************************************
  161.                            GAMES   MAKING
  162.  
  163.  As this is officially a `Beginners Guide',we don't intend to go too deeply
  164. into the world of games making,as its a very complicated area and is handled
  165. in the other `AMOSSIBLE' disks(Especially "AMOSSIBLE 2")-So check out the
  166. "Catalogue" file for more info.
  167.     To start you off though,you'll need to refer to the programs that
  168. specifically deal with Bobs(We use Bobs instead of Sprites simply because
  169. they are alot more versatile and alot easier to handle)and other aspects
  170. that can be linked with games-Such as sound,mathematics,and other graphics.
  171.     You really need to understand how a game works first of all-You don't
  172. even have to know how to write one yet-A knowledge of what actually happens
  173. at each stage of a game is invaluable.
  174.    Almost every game-Whether its a flight simulator or Shoot 'em Up-Has what
  175. we in `the trade' call a "Main Game Loop",all this involves is the various
  176. aspects of controlling the player and their foes.
  177.    Main elements include:
  178.  Altering the horizontal and vertical positions of the players Bob if they
  179. move the Joystick(Or mouse,or even keyboard if you want to).
  180.  Shooting a bullet `from' the players Bob if they press the fire button.
  181.  Checking to see if the bullet has hit anything,or if the player has been
  182. hit by enemy fire.
  183.  If anything has been hit,adjust their energy levels.
  184.  If energy levels are zero,take the `dead' things off of the screen.
  185.  Alter the score if neccesary.
  186.  Return to the start of the loop.
  187.  
  188. When designing a game,write down(In order) the things that you want the
  189. computer to check for.Eg Joystick movement,collisions etc. and what things
  190. happen at certain points(Do any of the player foes move?If so,adjust their
  191. positions).
  192.  
  193. *****************************************************************************
  194.  
  195.                ROUGH GUIDE TO AMOS
  196.  
  197.  
  198.  So you're new to AMOS,eh?
  199.  
  200.  This section is a whizz through various areas of AMOS that you'll come
  201. across.
  202.  
  203. PICTURES(IFF SCREENS):
  204.  So you've bought AMOS,but you've(probably)already used a paint
  205. package-Something like the vastly popular "Deluxe Paint" series,and after a
  206. week or so of using it,you should have saved a picture onto a disk.
  207.  You can now load upto 8 pictures into AMOS at one time,and display them in
  208. a variety of ways,activating a number of effects if you wish to.
  209.  
  210. BOBS AND SPRITES:
  211.  From a space invader to a Teenage mutant Ninja terrapin,the name of the
  212. special type of graphics that fly around screen(Or sometimes stay still)can
  213. be Bobs or Sprites.
  214.  A Bob is a Blitter Object,which means it is controlled by the Amigas
  215. Blitter chip.
  216.  The Bob is the little brother of the Sprite,which,while having a number of
  217. size and display restrictions,uses very little memory and can be moved
  218. around screen very fast.
  219.     Basically Bobs can be drawn in upto 64 colours,and there can be upto 64
  220. of them on screen(There are ways of changing the number allowed,but don't
  221. worry about that for the moment),but they move slowly when compared to
  222. sprites-Who are limited to 15 colours and amximum size of 16 pixels wide and
  223. 255 pixels high.
  224.    What you use is upto you-Weigh up the alternatives-You can actually use
  225. Sprites and Bobs on screen at the same time if you really want to!
  226.   One thing you should note is;You may see an object on screen with many
  227. moving parts-This is most likely to have been made up of several different
  228. Bobs or Sprites placed closely together.
  229.   A Sprite or Bob is more likely to be used as something which the player/
  230. user interacts with in some way.
  231.  In a typical game,Bobs/Sprites will include:
  232. The players `ship',any weapons fired from the ship,aliens,and any weapons
  233. that they fire-Plus bonus items and any number of other things.
  234. PLEASE NOTE THAT DUE TO THE RESTRICTIONS MADE BY ITS MAKERS,EASY AMOS DOES
  235. NOT USE SPRITES.
  236.  
  237. AMAL:
  238.  For games,a knowledge of AMAL is sometimes invaluable."Easy AMOS" owners
  239. should note that AMAL is not available to them,but the cost of an upgrade to
  240. "AMOS 1.3" is small(A back issue of "CU Amiga" or "Amiga Format" will give
  241. it you for about £4-They both had it on recent cover disks).
  242.  AMAL is the facility in AMOS that allows Bobs,Sprites,and even screens to
  243. be moved and `animated'.
  244. AMAL uses its own set of instructions,and can operate seperately from the
  245. main program when activated.
  246.  
  247. BACKGROUNDS,MAPS AND TILES:
  248.  Unlike a normal picture which you create in Deluxe Paint and just load in,
  249. some programs(especially games)require very large screens(Which they scroll
  250. through)-But the larger the screen,the more valuable memory is used up.
  251.  To solve this problem,some clever people thought that most screens have
  252. certain areas that look the same(Eg.Brick walls,floors etc.)-So why not take
  253. a few of these main elements  and put them in small squares called
  254. "Tiles"-These tiles can then be placed over the screen,but because you may
  255. only use 6(For example)small chunks of graphics,and repeatedly place them
  256. around the screen,you use alot less memory than one big picture.
  257.  Each tile can be given a special number,and using this,you can set up
  258. various routines to detect if a `player' has entered a certain area of the
  259. screen,and then you can create a reaction.
  260. If you've ever played "Super Mario" you'll know that you can't just walk
  261. through the scenary-Some bits of it affect you in diffent ways.In "Super
  262. Sprint" you can't dive anywhere and in "Lemmings",your little pals can't
  263. just walk anywhere-This is all due to these screens made out of tiles-A
  264. screen made out of tiles is called a "Map".
  265.  You may have heard about "TOME"(The Total Map Editor),this is an extension
  266. for AMOS and makes the creation of these maps alot easier,and it is
  267. available from Shadow software via the Official AMOS PD library.
  268.  
  269.  
  270. SAMPLED SOUND AND MUSIC:
  271. Listen....Nothing?Ah well,AMOS can bring your creations to life with
  272. dramatic sound effects and a sweeping soundtrack.
  273.  For the sound effects,you can utilize the Amigas hardware and AMOS'
  274. commands,or load in some sampled sounds from a sampler such as "AMAS".
  275.  Music can come from several sources,the most common being a `tracker'
  276. -A tracker(Or sequencer) is a computer utility which allows the user to
  277. enter musical notes `into' any of the Amigas four sound channels(Or tracks)
  278. via the keyboard and then play them back in sequence.
  279.  You can find trackers such as "MED" and "SoundTracker" in most Public
  280. Domain libraries.
  281.  
  282.  
  283.  
  284. *****************************************************************************
  285.  
  286. FLOWCHARTS
  287.  
  288. A small note on this useful planning aid.
  289. As a form of strict planning,you can write out a flow chart of your
  290. programs. 
  291. A flowchart consists of a chain of events and then any reactions that lead
  292. from them-All you have to do is write one down on paper.
  293. This may seem a waste of time,but it can eliminate an awful lot of wasted
  294. time.
  295.  You may think you've worked out the perfect program,but "Many a slip twix
  296. cup and lip"(Or in plain english"Theres still plenty that could go wrong!")
  297. -If you write down EXACTLY what the computer will do at each stage(And what
  298. results it will produce),you might come across mistakes you hadn't noticed.
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.